package com.authine.cloudpivot.ext.mapper;

import com.authine.cloudpivot.ext.domain.Number;
import com.authine.cloudpivot.ext.domain.NumberVo;
import com.authine.cloudpivot.util.MyMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.math.BigDecimal;

@Mapper
public interface NumberMapper extends MyMapper<Number> {

    @Select("SELECT code,id FROM `i598n_number` WHERE corpId  = #{corpId}")
    NumberVo getMaxCode(String corpId);

    @Insert("INSERT INTO i598n_number (`code`,corpId,id,creater) VALUES (#{code},#{corpId},#{id},#{creater})")
    int insertCode(int code, String corpId,String id,String creater);

    @Update("update i598n_number set code = #{code} where id = #{id}")
    int update(BigDecimal code, String id);
}